Tail -f or watch for postgres

Tail -f or watch for postgres

am 20.04.2010 09:20:56 von Renato Oliveira

--_000_7965A9DCF12CC14984420BCC37B1608F25AC0B9EF1Elzargrantc ou_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Dear all,

It may sounds crazy it may not sound so crazy.

I was here think are there any commands to watch new transactions rolling t=
hrough the screen like a terminal monitor?

For example, if you want to watch a log file you can execute the command; t=
ail -f or watch.
This will keep the log entries rolling and being displayed on screen.

Is there something similar to postgreSQL?

Thank you very much

Best regards

Renato



Renato Oliveira
Systems Administrator
e-mail: renato.oliveira@grant.co.uk

Tel: +44 (0)1763 260811
Fax: +44 (0)1763 262410
www.grant.co.uk

Grant Instruments (Cambridge) Ltd

Company registered in England, registration number 658133

Registered office address:
29 Station Road,
Shepreth,
CAMBS SG8 6GB
UK





P Please consider the environment before printing this email
CONFIDENTIALITY: The information in this e-mail and any attachments is conf=
idential. It is intended only for the named recipients(s). If you are not t=
he named recipient please notify the sender immediately and do not disclose=
the contents to another person or take copies.

VIRUSES: The contents of this e-mail or attachment(s) may contain viruses w=
hich could damage your own computer system. Whilst Grant Instruments (Cambr=
idge) Ltd has taken every reasonable precaution to minimise this risk, we c=
annot accept liability for any damage which you sustain as a result of soft=
ware viruses. You should therefore carry out your own virus checks before o=
pening the attachment(s).

OpenXML: For information about the OpenXML file format in use within Grant =
Instruments please visit our website ..html>

--_000_7965A9DCF12CC14984420BCC37B1608F25AC0B9EF1Elzargrantc ou_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

icrosoft.com/office/2004/12/omml" xmlns:o=3D"urn:schemas-microsoft-com:offi=
ce:office" xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:w=3D"urn:schemas=
-microsoft-com:office:word"> ascii" http-equiv=3D"Content-Type">
>












Dear all,



 



It may sounds crazy it may not sound so crazy. :p>



 



I was here think are there any commands to watch new
transactions rolling through the screen like a terminal monitor?=



 



For example, if you want to watch a log file you can e=
xecute
the command; tail –f <logfile> or watch.



This will keep the log entries rolling and being displ=
ayed
on screen.



 



Is there something similar to postgreSQL? p>

 



Thank you very much



 



Best regards



 



Renato



 



 






 

Renato=
Oliveira
Systems Administrator
e-mail: renato.oliveira@grant.co.uk FONT>
>

> 

Tel: +=
44 (0)1763 260811
Fax: +44 (0)1763 262410
..co.uk/">www.grant.co.uk

> 

Grant =
Instruments (Cambridge) Ltd
 
Company registered in England, re=
gistration number 658133
 
Registered office address:
29 Stat=
ion Road,
Shepreth,
CAMBS SG8 6GB
UK

> ONT> 

>

> 

>

 

>

 


; COLOR: green; FONT-FAMILY: Webdings"> 


; COLOR: green; FONT-FAMILY: Webdings">P =3D"EN-US" STYLE=3D"FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Verdana','=
sans-serif'">
OLOR: green; FONT-FAMILY: 'Arial','sans-serif'">Please consider the environ=
ment before printing this email


CONFIDENTIALITY: The =
information in this e-mail and any attachments is confidential. It is inten=
ded only for the named recipients(s). If you are not the named recipient pl=
ease notify the sender immediately and do not disclose the contents to anot=
her person or take copies.

 


VIRUSES: The contents=
of this e-mail or attachment(s) may contain viruses which could damage you=
r own computer system. Whilst Grant Instruments (Cambridge) Ltd has taken e=
very reasonable precaution to minimise this risk, we cannot accept liabilit=
y for any damage which you sustain as a result of software viruses. You sho=
uld therefore carry out your own virus checks before opening the attachment=
(s).

 


OpenXML: For informat=
ion about the OpenXML file format in use within Grant Instruments please vi=
sit our =


--_000_7965A9DCF12CC14984420BCC37B1608F25AC0B9EF1Elzargrantc ou_--

Re: Tail -f or watch for postgres

am 20.04.2010 12:32:57 von Scott Marlowe

On Tue, Apr 20, 2010 at 1:20 AM, Renato Oliveira
wrote:
> Dear all,
>
> It may sounds crazy it may not sound so crazy.
>
> I was here think are there any commands to watch new transactions rolling
> through the screen like a terminal monitor?
>
> For example, if you want to watch a log file you can execute the command;
> tail =96f or watch.
>
> This will keep the log entries rolling and being displayed on screen.
>
> Is there something similar to postgreSQL?

while true; do psql mydb -c "select * from pg_stat_activity where
current_query <>''";sleep 10;done

or something like that.

--=20
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

Re: Tail -f or watch for postgres

am 20.04.2010 14:28:08 von Scott Mead

--00151747c002c44a430484aa3585
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

On Tue, Apr 20, 2010 at 6:32 AM, Scott Marlowe wro=
te:

> On Tue, Apr 20, 2010 at 1:20 AM, Renato Oliveira
> wrote:
> > Dear all,
> >
> > It may sounds crazy it may not sound so crazy.
> >
> > I was here think are there any commands to watch new transactions rolli=
ng
> > through the screen like a terminal monitor?
> >
> > For example, if you want to watch a log file you can execute the comman=
d;
> > tail =96f or watch.
> >
> > This will keep the log entries rolling and being displayed on screen.
> >
> > Is there something similar to postgreSQL?
>
> while true; do psql mydb -c "select * from pg_stat_activity where
> current_query <>''";sleep 10;done
>
> or something like that.
>

That's a good one --

You could also set 'log_min_duration_statement =3D 1000 '

(This logs all statements taking 1 second or more into the logfile),
then do a 'tail -f ' on the latest log in the pg_log folder. The lower yo=
u
set log_min_duration_statement, the more overhead you place on your databas=
e
(this could be significant, so be careful).

--Scott


>
> --
> Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-admin
>

--00151747c002c44a430484aa3585
Content-Type: text/html; charset=windows-1252
Content-Transfer-Encoding: quoted-printable


On Tue, Apr 20, 2010 at 6:32 AM, Scott Marlo=
we <scott.m=
arlowe@gmail.com
>
wrote:
style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
On Tue, Apr 20, 2010 at 1:20 AM, Renato Oliveira

<renato.oliveira@grant.co=
..uk
> wrote:

> Dear all,

>

> It may sounds crazy it may not sound so crazy.

>

> I was here think are there any commands to watch new transactions roll=
ing

> through the screen like a terminal monitor?

>

> For example, if you want to watch a log file you can execute the comma=
nd;

> tail =96f <logfile> or watch.

>

> This will keep the log entries rolling and being displayed on screen.<=
br>
>

> Is there something similar to postgreSQL?



while true; do psql mydb -c "select * from pg_stat_activity wher=
e

current_query <>'<IDLE>'";sleep 10;done



or something like that.

That's a go=
od one --=A0

  You could also set 'log_min=
_duration_statement =3D 1000 '

   =A0(This=
logs all statements taking 1 second or more into the logfile), then do a &=
#39;tail -f ' on the latest log in the pg_log folder. =A0 The lower you=
set log_min_duration_statement, the more overhead you place on your databa=
se (this could be significant, so be careful).


--Scott=A0
=A0
l_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left=
:1ex;">


--

Sent via pgsql-admin mailing list ( ..org">pgsql-admin@postgresql.org)

To make changes to your subscription:

_blank">http://www.postgresql.org/mailpref/pgsql-admin




--00151747c002c44a430484aa3585--